package hibernate.xml43.view;


import hibernate.xml43.pojo.Dept;
import hibernate.xml43.util.HibernateHandler;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

public class View7 {
	
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Session session = HibernateHandler.getSession();
		Criteria cri = session.createCriteria(Dept.class);
		//添加限制条件(deptno>10)
		cri.add(Restrictions.gt("deptno", 10));
		List<Dept> list = cri.list();
		for(Dept d : list){
			System.out.println(d.getDeptno()+"\t"+d.getDname()+"\t"+d.getLoc());
		}
	}
}
